using Gee;
using Gtk;
using Meridian.Data;

namespace Meridian.Side {

public class Download : SideItem, GLib.Object {

    public string title {get; set construct;}
    public string url {get; set construct;}
    public string path {get; construct;}
    public DateTime date_added {get; construct;}

    public Download (string title, string url, string path) {
        GLib.Object(title : title, url : url, path : path, date_added : new DateTime.now_local ());
    }
    
    public Download.recover (string title, string url, string path, DateTime date_added) {
        GLib.Object(title : title, url : url, path : path, date_added : date_added);
    }
 
    public HashMap<string, string> get_fields () {
        var fields = new HashMap<string, string> ();
        fields.set ("title", this.title);
        fields.set ("url", this.url);
        fields.set ("path", this.path);
        fields.set ("date_added", this.date_added.to_string ());
        return fields;
    }
    
    public DataTable get_table () {
        return DataTable.DOWNLOAD;
    }

}
}